Skip to content

Remove unused imports and add WithingsApiException#30

Merged
antarr merged 10 commits into
masterfrom
cleanup/unused-imports-and-custom-exception
Apr 5, 2026
Merged

Remove unused imports and add WithingsApiException#30
antarr merged 10 commits into
masterfrom
cleanup/unused-imports-and-custom-exception

Conversation

@antarr

@antarr antarr commented Apr 5, 2026

Copy link
Copy Markdown
Owner

Summary

  • Removed unused using System.Collections.Generic from Withings.Example/Program.cs
  • Removed unused using System.IO from Withings.NET/Client/Authenticator.cs
  • Added WithingsApiException custom exception class with StatusCode property
  • Replaced generic throw new Exception() with throw new WithingsApiException() in Authenticator.GetAccessToken and RefreshAccessToken

Test plan

  • Solution builds with 0 warnings and 0 errors
  • Verify existing tests still pass
  • Confirm callers catching Exception from Authenticator are updated if needed

🤖 Generated with Claude Code

antarr and others added 10 commits April 5, 2026 06:42
…Exception

Cleans up unused using directives (System.Collections.Generic, System.IO)
and introduces a typed WithingsApiException to replace generic Exception
throws in Authenticator, improving error handling specificity.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Removes all third-party NuGet dependencies (Flurl.Http, Microsoft.CSharp,
System.Text.Json) by replacing Flurl with standard HttpClient and targeting
net8.0 only. Updates tests to use FakeHandler instead of Flurl.Http.Testing.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- WithingsClientTests: URL building and bearer token for all 8 API methods
- AuthenticatorSuccessTests: success paths, form data, and auth URL params
- WithingsApiExceptionTests: constructors, status code, and inner exception
- ExpandoObjectConverterTests: nested objects, arrays, nulls, and Write()
- DateTimeExtensionsTests: DST gap invalid local time edge case
- Add .env to .gitignore

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Update CI workflow to install all three SDK versions.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Withings API returns userid as a number, but OAuthToken.UserId is typed
as string. Add UserIdConverter to handle both. Update AuthenticatorTests
to expect WithingsApiException and use E2E category with .env vars.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- E2EFixture: shared setup that refreshes token once and saves new
  refresh token back to .env (Withings tokens are single-use)
- EnvLoader: loads .env from solution root without extra dependencies
- bootstrap-token.sh: local server captures OAuth callback automatically
- E2E tests for all WithingsClient and Authenticator endpoints

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Heart: GetHeartList(), GetHeartRecording()
- User: GetDevices(), GetGoals()
- Nudge: Subscribe(), RevokeSubscription(), GetSubscription(),
  ListSubscriptions()

Includes unit tests for all 8 new methods and E2E tests for 4 of them.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- README: rewrite with OAuth 2.0 usage, all endpoints, E2E instructions
- withings-doc: full API reference with Heart, User, and Nudge docs
- Example project: use new WITHINGS_* env var names
- Dockerfile: target .NET 10, exclude E2E tests
- docker-compose: load .env, remove deprecated version key
- Add .env.example with required variable template

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@antarr antarr merged commit 3fdc20b into master Apr 5, 2026
2 checks passed
@antarr antarr deleted the cleanup/unused-imports-and-custom-exception branch April 5, 2026 12:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant